﻿using System;
using Terraria.GameContent.UI.Elements;
using Terraria.Localization;
using Terraria.UI;

namespace Terraria.ModLoader.UI
{
	// Token: 0x0200028D RID: 653
	internal class UILoadMods : UIState
	{
		// Token: 0x06001A69 RID: 6761 RVA: 0x0042934C File Offset: 0x0042754C
		public override void OnInitialize()
		{
			this.loadProgress = new UILoadProgress();
			this.loadProgress.Width.Set(0f, 0.8f);
			this.loadProgress.MaxWidth.Set(600f, 0f);
			this.loadProgress.Height.Set(150f, 0f);
			this.loadProgress.HAlign = 0.5f;
			this.loadProgress.VAlign = 0.5f;
			this.loadProgress.Top.Set(10f, 0f);
			base.Append(this.loadProgress);
			this.subProgress = new UIText("", 0.5f, true);
			this.subProgress.Top.Set(65f, 0f);
			this.subProgress.HAlign = 0.5f;
			this.subProgress.VAlign = 0.5f;
			base.Append(this.subProgress);
		}

		// Token: 0x06001A6A RID: 6762 RVA: 0x00012D26 File Offset: 0x00010F26
		internal void SetProgressFinding()
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSFinding"));
				this.loadProgress.SetProgress(0f);
			}
		}

		// Token: 0x06001A6B RID: 6763 RVA: 0x00012D54 File Offset: 0x00010F54
		internal void SetProgressCompatibility(string mod, int num, int max)
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSCompatibilizing", mod));
				this.loadProgress.SetProgress((float)num / (float)max);
			}
		}

		// Token: 0x06001A6C RID: 6764 RVA: 0x00429454 File Offset: 0x00427654
		internal void SetProgressReading(string mod, int num, int max)
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSReading", mod));
				this.loadProgress.SetProgress((float)num / (float)max);
				return;
			}
			if (num == 0)
			{
				Console.WriteLine(Language.GetTextValue("tModLoader.MSReading", mod));
			}
		}

		// Token: 0x06001A6D RID: 6765 RVA: 0x004294A4 File Offset: 0x004276A4
		internal void SetProgressInit(string mod, int num, int max)
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSIntializing") + mod);
				this.loadProgress.SetProgress((float)num / (float)max);
				return;
			}
			Console.WriteLine(Language.GetTextValue("tModLoader.MSIntializing") + mod);
		}

		// Token: 0x06001A6E RID: 6766 RVA: 0x00012D83 File Offset: 0x00010F83
		internal void SetSubProgressInit(string message)
		{
			if (!Main.dedServ)
			{
				this.subProgress.SetText(message);
			}
		}

		// Token: 0x06001A6F RID: 6767 RVA: 0x00012D98 File Offset: 0x00010F98
		internal void SetProgressSetup(float progress)
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSSettingUp"));
				this.loadProgress.SetProgress(progress);
			}
		}

		// Token: 0x06001A70 RID: 6768 RVA: 0x004294FC File Offset: 0x004276FC
		internal void SetProgressLoad(string mod, int num, int max)
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSLoading") + mod);
				this.loadProgress.SetProgress((float)num / (float)max);
				return;
			}
			Console.WriteLine(Language.GetTextValue("tModLoader.MSLoading") + mod);
		}

		// Token: 0x06001A71 RID: 6769 RVA: 0x00012DC2 File Offset: 0x00010FC2
		internal void SetProgressRecipes()
		{
			if (!Main.dedServ)
			{
				this.loadProgress.SetText(Language.GetTextValue("tModLoader.MSAddingRecipes"));
				this.loadProgress.SetProgress(0f);
			}
		}

		// Token: 0x040017A1 RID: 6049
		private UILoadProgress loadProgress;

		// Token: 0x040017A2 RID: 6050
		private UIText subProgress;
	}
}
